<template>
	<view class="content">
		<view class="pt-10">
			<view class="balance t-c c1a">
				<view class="f14">余额</view>
				<view class="f30 f-w">￥{{money}}</view>
			</view>
		</view>
		<view class="title">
			收支明细
		</view>
		<view class="list">
			<view class="list_item" v-for="item in money_list">
				<view class="d-f j-b">
					<view class="c1a f14">{{item.title}}</view>
					<view :class="[item.type == 1?'c2d':'c1a']" class="f14 f-w">劳务费 <text v-if="item.type == 1">-</text><text v-if="item.type == 0">+</text>  {{item.money}} <text style="margin-left: 20px;" v-if="item.geshui">个税-{{item.geshui}}</text> </view>
				</view>
				<view class="d-f j-b">
					<view class="caa f12">{{item.created_at}}</view>
					<view :class="[item.type == 1?'c2d':'c1a']" class="14">
						<text v-if="item.type == 0">已结算</text>
						<text v-if="item.type == 1">已提现</text>
					</view>
				</view>
			</view>
		</view>
		<view class="t-c f16 cc9" style="margin-top:20rpx;padding-bottom: 30px" v-if="text">我也是有底线的~</view>
	</view>
</template>

<script>
	import unis from '@/utils/util.js'
	export default {
		data() {
			return {
				page:1,
				page_size:10,
				money_list:[],
				lastPage:0,
				text:false,
				money:0
			}
		},
		onLoad(e) {
			console.log(e)
			this.money = e.money
			this.lists()
		},
		methods: {
			lists(){
				var that = this
				unis.getData('/api/member/money_log', 'get', {
					page:that.page,
					page_size:that.page_size,
				}, function (res) {
					if(res.code == 200){
						that.last_page = Math.ceil(res.data.total / that.page_size)
						if (that.page == 1) {
							that.money_list = res.data.list,
							that.text = false
						} else {
							that.money_list = that.money_list.concat(res.data.list),
							that.text = false
						}
					}
				});
			},
		},
		onReachBottom(){
			if (this.page >= this.last_page) {
				this.text = true
			  return false
			}
			this.page++
			this.lists()
		},
	}
</script>

<style lang="scss" scoped>
.balance{
	margin:0 16px 10px 16px;
	background-color: #fff;
	border-radius: 4px 4px 4px 4px;
	padding: 22px 0 15px 0;
	.f30{
		margin-top: 5px;
	}
}
.title{
	margin:13px 16px 10px 16px;
}
.list{
	background-color: #fff;
	padding: 0 16px;
	.list_item{
		border-bottom: 1px solid #D8D8D8;
		padding: 19px 0;
		line-height: 30px;
		&:last-child{
			border: 0;
		}
	}
}
</style>
